# Maintainer: Sergio Talens-Oliag <sto@mixinet.net>
pkgname=tmpl
pkgver=0.4.0
pkgrel=1
pkgdesc="Tool to process templates using Golang text/template and Sprig functions"
url="https://github.com/krakozaure/tmpl"
arch="all"
license="MIT"
makedepends="go"
subpackages="$pkgname-doc"
options="!check"  # no tests provided

source="$pkgname-$pkgver.tar.gz::https://github.com/krakozaure/tmpl/archive/refs/tags/v$pkgver.tar.gz"

export CGO_ENABLED=0
export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"
export GOFLAGS="$GOFLAGS -modcacherw"

build() {
	go build -v -o . \
		-ldflags "-s -w -X github.com/krakozaure/tmpl/version.Version=v$pkgver"
}

package() {
	install -Dm755 tmpl -t "$pkgdir"/usr/bin/
	install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

sha512sums="
b45306b2592cfc0faf3549347c19904e023715152ed56a3aae0cc653b1445b01ce65b4c5357ab0a34e74633c27054e25e0d0c3d09c6637702c1e220f753e1392  tmpl-0.4.0.tar.gz
"
